<?php
$dbh = new PDO("oci:dbname=adDB", "readonly", "7G70ggBZ");
?>
<script src="jquery-1.4.2.min.js"></script>
<script>
$(function(){
	$("tr:odd").addClass('a');
	$("select").change(function(){
		location.href='?&table='+$(this).val();
	});
});
</script>
<style>
.a{
	background:#EEEEEE;
}
</style>
<select id="select1">
<?php
//显示所有表
//select table_name from all_tables where owner='ADMANAGER65'
$res = $dbh->query("select table_name from all_tables where owner='ADMANAGER65'");
$res->setFetchMode(PDO::FETCH_ASSOC);
$rs = $res->fetchAll();
foreach ($rs as $item) {
?>
	<option><?php echo $item['TABLE_NAME']?></option>
<?php
}
?>
</select>

<?php
//使用PDO连接Oracle

$tableName = isset($_GET['table']) ? $_GET['table'] : 'ng_ads';

$res = $dbh->query("select * from admanager65.$tableName where rownum<=100");
$res->setFetchMode(PDO::FETCH_ASSOC);
$rs = $res->fetchAll();
echo '<b>'.$tableName.'</b><br />';

if($rs) {
	echo '<table border=1>';
	foreach ($rs[0] as $key=>$value) {
		echo '<th>'.$key.'&nbsp;</th>';
	}
	foreach ($rs as $item) {
		echo '<tr>';
	    foreach ($item as $item2) {
	    	echo '<td>'.$item2.'&nbsp;</td>';
	    }
	    echo '</tr>';
	}
	echo '</table>';
} else {
	echo 'Empty!';
}

echo '<br />NumRows:'.count($rs);
?>